from datetime import datetime

# 用户实体
class User:
    def __init__(self,
                 username,
                 password,
                 age=None,
                 gender=None,
                 height=None,
                 weight=None,
                 diabetes_type=None,
                 hypertension=False,
                 smoking_history=False,
                 genetic_factor=False,
                 id=None,
                 created_at=None,
                 updated_at=None):
        self.id = id
        self.username = username
        self.password = password
        self.age = age if age is not None else 0  # 设置默认值
        self.gender = gender if gender is not None else ""  # 设置默认值
        self.height = height if height is not None else 0.0  # 设置默认值
        self.weight = weight if weight is not None else 0.0  # 设置默认值
        self.diabetes_type = diabetes_type
        self.hypertension = hypertension
        self.smoking_history = smoking_history
        self.genetic_factor = genetic_factor
        self.created_at = created_at
        self.updated_at = updated_at
# 健康卡实体
from datetime import datetime

class HealthCard:
    def __init__(self, user_id, bmi=None, blood_pressure=None, blood_lipids=None, skin_thickness=None,
                 insulin_level=None, diabetes_genetic_function=None, pregnancies=None, id=None, created_at=None):
        self.id = id
        self.user_id = user_id
        self.bmi = bmi
        self.blood_pressure = blood_pressure
        self.blood_lipids = blood_lipids
        self.skin_thickness = skin_thickness
        self.insulin_level = insulin_level
        self.diabetes_genetic_function = diabetes_genetic_function
        self.pregnancies = pregnancies  # 新增：怀孕次数字段
        self.created_at = created_at if created_at else datetime.now()
# 血糖数据实体
class GlucoseData:
    def __init__(self, user_id, glucose_level, recorded_at=None, id=None):
        self.id = id
        self.user_id = user_id
        self.glucose_level = glucose_level
        self.recorded_at = recorded_at if recorded_at else datetime.now()

# 其他实体（如预警、问答、饮食计划、管理建议）可类似扩展，这里先聚焦核心功能